package com.gradledemo.service;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import org.springframework.stereotype.Service;

/*
 * Copyright (c) 2010-2015 LiZaoNet Inc. (http://www.lizaonet.com).
 * license: http://www.lizaonet.com
 */

/**
 * Created by charles on 2014-8-2.
 */
@Service
public class MailService {

    public void sendMail() throws EmailException {
        HtmlEmail email = new HtmlEmail();
        email.setHostName("smtp.qq.com");
        email.setAuthentication("214896205@qq.com", "t1ncha)2001-");
        email.addTo("charles@lizaonet.com");
        email.setFrom("214896205@qq.com");
        email.setSubject("主题：该邮件包括html格式内容");
        email.setHtmlMsg("<html>The apache logo - <h2>logo</h2></html>");
        email.send();
    }
}
